/**
 * Copyright (c) 2007,中企动力华南研发中心
 * All rights reserved.
 */
package com.ce.pms.common.web;

import java.util.Date;

import com.ce.pms.base.web.PmsBaseAction;
import com.sitechasia.webx.core.annotation.Read;
import com.ce.util.BlankUtil;
import com.ce.util.DateUtil;

/**
 * 功能描述：
 * @author 罗军林 创建日期：2008-5-9
 */
public class SysrefcodeAction extends PmsBaseAction{

	public void compareCurrentDate(@Read(key="dataValue")String dataValue,
			@Read(key="dateFormat")String dateFormat,
			@Read(key="compareType")String compareType) {

		try{
			if(BlankUtil.isBlank(dataValue)){
				this.renderText("true");
				return ;
			}
			Date now=sysrefcodeService.getDate();
			String nowStr=DateUtil.convertDateToStr(now,dateFormat);
             int value=-2;
			if(dataValue.compareTo(nowStr)>0){
				value=1;
			} else if(dataValue.compareTo(nowStr)<0){
				value=-1;
			} else {
				value=0;
			}

			if("bigCurrentDate".equals(compareType)){
				if(1==value){
				this.renderText("true");
				} else {
					 this.renderText("false");
				}
			}
			if("bigEqualsCurrentDate".equals(compareType)){
				if(1==value || 0==value){
					this.renderText("true");
				} else {
					 this.renderText("false");
				}
			}
			if("smallCurrentDate".equals(compareType)){
				if(-1==value){
					this.renderText("true");
			   } else {
				   this.renderText("false");
			    }
			}
			if("smallEqualsCurrentDate".equals(compareType)){
				if(-1==value || 0==value){

					this.renderText("true");

			     } else {
			    	 this.renderText("false");
			     }
			}

			if(-2==value){
				this.renderText("true");
			}

		}
		catch(Exception ee){
			this.renderText("false");
		}




	}


}
